<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>node+express配置第一个api</title>
    <script src="http://lib.sinaapp.com/js/jquery/2.0.2/jquery-2.0.2.min.js"></script>
</head>
<body>
<input type="button" value="异步请求服务器" onclick="fn1()"><span id="span1"></span><br>
    
<script>
    function fn1(){
        $.ajax({
            type:'get',
            url:"http://localhost:3002/api",
            success:function(data){
                console.log(data)
                $('#span1').innerHTML=data;
            },
            err:function(err){
                console.log(err)
            }
        })
    }
</script>
</body>
</html>